<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>邀请有礼</title>
<link rel="stylesheet" href="/style/new/css/base.css">
<link rel="stylesheet" href="/style/new/css/swiper.min.css"/>
<link rel="stylesheet" href="/style/new/css/xshop.css" />
<script src="/style/new/js/swiper.min.js"></script>
<script src="/style/new/js/jquery-1.12.0.min.js"></script>
<script src="/style/new/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="/style/new/js/xShop.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="/style/js/jquery.qrcode.min.js"></script>
</head>
<body>
<div class="outwrap">
    <!--top-->  
    <div class="topbar clearfix topvh">
        <a href="app://www/me.html" class="btn-back">
            <i class="ico-back"></i><span>返回</span>
        </a>
        <h2 class="title">邀请有礼</h2>
    </div>
    <div class="meinner-adr-add">
        <div class="tuijianma-inner">
            <div class="tuijianma-inner-pic" id="qrcode"><!--  <img src="/style/new/images/erweima.jpg"/>--></div>
            <p class="tuijianma-inner-ma">我的邀请码：<span><?=$this->data['recode'];?></span></p>
            <p class="tuijianma-inner-font">说明：数据恢复了刷卡缴费刷卡缴费的会计法短款 刷卡来得及是你肯定会索拉卡点击发算了电脑速度 刷卡来得及上课辣椒粉刷卡缴费</p>
        </div>
    </div>
</div>

<!--底部导航-->
<div class="foot-menu foot-new">
    <ul class="clearfix">
        <li><a href="/"><i class="ico-7"></i><span>推荐</span></a></li>
        <li><a href="/rcm"><i class="ico-1"></i><span>商城</span></a></li>
        <li><a href="/cart/cart"><i class="ico-5"></i><span>购物车</span></a></li>        
        <li><a href="/user/index"><i class="ico-4"></i><span>我的</span></a></li>
    </ul>
</div>
<script>
var recode = '<?=$this->data['recode']?>';
var url  = "https://<?= $this->c['cookie']['host']?>/mystore/open?code="+recode;
$("#qrcode").qrcode({
    render: "canvas", //table方式
//    width: 180, //宽度
//    height:180, //高度
    text: url //任意内容
});
// });
function convertCanvasToImage(canvas) {
    //新Image对象，可以理解为DOM
    var image = new Image();
    // canvas.toDataURL 返回的是一串Base64编码的URL，当然,浏览器自己肯定支持
    // 指定格式 PNG
    image.src = canvas.toDataURL("image/png");
    return image;
}

//获取网页中的canvas对象
var mycanvas1=document.getElementsByTagName('canvas')[0];
//将转换后的img标签插入到html中
var img=convertCanvasToImage(mycanvas1);
$('#qrcode').html(img);//imagQrDiv表示你要插入的容器id


function save_qrocde() {
   var  qrcode_img =  $('#qrcode').find('img').attr('src');
//   var img_url = "<img src="+qrcode_img+">";
  // alert(img_url);
     var   oPop   =   window.open(qrcode_img);
     oPop.document.execCommand(qrcode_img);
}
</script>
</body>
</html>